package com.yl.danmo.controller;


import com.yl.common.core.utils.poi.ExcelUtil;
import com.yl.common.core.web.controller.BaseController;
import com.yl.common.core.web.domain.AjaxResult;
import com.yl.common.core.web.page.TableDataInfo;
import com.yl.common.log.annotation.Log;
import com.yl.common.log.enums.BusinessType;
import com.yl.danmo.domain.DanmoPersonalPictures;
import com.yl.danmo.service.IDanmoPersonalPicturesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 个人信息作品图片集Controller
 * 
 * @author yl
 * @date 2025-04-15
 */
@RestController
@RequestMapping("/personalPictures")
public class DanmoPersonalPicturesController extends BaseController
{
    @Autowired
    private IDanmoPersonalPicturesService danmoPersonalPicturesService;

    /**
     * 查询个人信息作品图片集列表
     */
//    @RequiresPermissions("system:personalPictures:list")
    @GetMapping("/list")
    public TableDataInfo list(DanmoPersonalPictures danmoPersonalPictures)
    {
        startPage();
        List<DanmoPersonalPictures> list = danmoPersonalPicturesService.selectDanmoPersonalPicturesList(danmoPersonalPictures);
        return getDataTable(list);
    }

    /**
     * 导出个人信息作品图片集列表
     */
//    @RequiresPermissions("system:personalPictures:export")
    @Log(title = "个人信息作品图片集", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DanmoPersonalPictures danmoPersonalPictures)
    {
        List<DanmoPersonalPictures> list = danmoPersonalPicturesService.selectDanmoPersonalPicturesList(danmoPersonalPictures);
        ExcelUtil<DanmoPersonalPictures> util = new ExcelUtil<DanmoPersonalPictures>(DanmoPersonalPictures.class);
        util.exportExcel(response, list, "个人信息作品图片集数据");
    }

    /**
     * 获取个人信息作品图片集详细信息
     */
//    @RequiresPermissions("system:personalPictures:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(danmoPersonalPicturesService.selectDanmoPersonalPicturesById(id));
    }

    /**
     * 新增个人信息作品图片集
     */
//    @RequiresPermissions("system:personalPictures:add")
    @Log(title = "个人信息作品图片集", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DanmoPersonalPictures danmoPersonalPictures)
    {
        return toAjax(danmoPersonalPicturesService.insertDanmoPersonalPictures(danmoPersonalPictures));
    }

    /**
     * 修改个人信息作品图片集
     */
//    @RequiresPermissions("system:personalPictures:edit")
    @Log(title = "个人信息作品图片集", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DanmoPersonalPictures danmoPersonalPictures)
    {
        return toAjax(danmoPersonalPicturesService.updateDanmoPersonalPictures(danmoPersonalPictures));
    }

    /**
     * 删除个人信息作品图片集
     */
//    @RequiresPermissions("system:personalPictures:remove")
    @Log(title = "个人信息作品图片集", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(danmoPersonalPicturesService.deleteDanmoPersonalPicturesByIds(ids));
    }




}
